<iframe />. From the preview_widgets-field from /third-party/dashboards you have the possibility to
fetch the widgets “raw” response. This means that you get a JSON-response that you can render
in the way you prefer in your App.
How?
After fetching from the /third-party/dashboards endpoint you can get a url that is for fetching a widgets “raw” data. You get the url inpreview_widgets.raw.url and then you need to authorize yourself with the headers from
preview_widgets.raw.headers, API-reference.
Widget Data Responses
Widgets can have multiple settings, which means their results may vary depending on configuration. Below are key scenarios and fields you should be aware of.Status Handling
Ifstatus.broken = true, the response will return null.
Data Response Structure
The main response is returned in thedata field, which is a list of items. Each item has a title and a data array.
- The first item in the list is always the segment (except for
KEY_FIGUREwidgets). - Each
dataentry can contain either strings (labels) or numbers (values).
- Real estate 1 → 200 reported errands
- Real estate 2 → 302 reported errands, etc.
data_type field, indicating whether the values are strings or numbers.
Comparative Data
If the widget compares values across different time periods, comparative results appear in thecomparative_data field.
- The structure matches the
datafield. - The
comparative_display_typefield defines how values are displayed:VALUE: raw values from the comparative periodPERCENTAGE: percentage differences relative to that period
Widget Type (meta.type)
The meta.type field specifies the type of widget returned.
-
For
KEY_FIGUREwidgets:- The response includes only one item in the
datalist. - That item’s value can be accessed directly at
data[0].data[0].
- The response includes only one item in the
-
For all other widgets:
- The structure follows the standard
dataandcomparative_dataformat described above.
- The structure follows the standard